package cn.nbt.busManage.model.entity;

import cn.nbt.busManage.model.dto.ScheduleDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@Table(name = "driver")
public class Driver extends BaseEntity   {
    @ManyToMany(cascade = CascadeType.PERSIST)
    @JoinTable(name = "driver_schedule",
            joinColumns = @JoinColumn(name = "driver_id"),
            inverseJoinColumns = @JoinColumn(name = "schedule_id"))
    private List<Schedule> schedules;
    @Column(name = "driver_name")
    private String driverName;
    @Column(name = "address")
    private String address;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "birthday")
    private LocalDateTime birthday;
    @Column(name = "cell")
    private String cell;

}
